﻿@model Q42.Wheels.Mvc.Paging.Paging
@using Q42.Wheels.Mvc.Paging

@if (!Model.IsFirstPage)
{ 
  @Html.RenderPageLink("Vorige", Model.CurrentPage - 1, new { @class = "custompaginationlink" }, false)
}

@for (int i = 0; i < Model.NumberPages; i++)
{
  if (i == 0 && Model.CurrentPage > 2)
  {
    @Html.RenderPageLink("Eerste", i, new { @class = "custompaginationlink" })
  }
  
  if (Math.Abs(Model.CurrentPage - i) < 3)
  {
    @Html.RenderPageLink((i + 1).ToString(), i, new { @class = "custompaginationlink" })
  }
  
  if (i == Model.NumberPages - 1 && Model.CurrentPage < Model.NumberPages - 3)
  {
    @Html.RenderPageLink("Laatste", i, new { @class = "custompaginationlink" })
  }
}

@if (!Model.IsLastPage)
{ 
  @Html.RenderPageLink("Volgende", Model.CurrentPage + 1, new { @class = "custompaginationlink" })
}